<!DOCTYPE html>
<html>
<head>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/mytags.jsp"%>
<title>系统管理界面</title>
<t:base type="jquery,lhgdialog"></t:base>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="static_resources/javascript/echarts-all.js"></script>
<script type="text/javascript">
$(function () {
	//最新公告
		$.ajax({
					url:'sys/SysNotice/list',
					data:{comp:1,page:1,rows:8,sort:'field(notice_top,1,0),add_time desc','beanProxy[enabled]':0},
					type:'post',
					dataType:'json',
					async:false,
					success:function(result){
						if(typeof(result)!='undefined' && result.state == 200){
							var aaData =  result['rows']; 
							if(typeof(aaData)!='undefined' && aaData.length>0){
								var newNotice = $('#newNotice'),length = aaData.length,max=length,str='';
								newNotice.empty();
								while(length>= 1){
									var row = aaData[max-length];
									str  = str + '<li><a href="jsp/sys/sys_notice_show.jsp?id='+row.id+'">'+(row.noticeTheme.length>20?(row.noticeTheme.substring(0,20)+'...'):row.noticeTheme)+'</a></li>';
									length--;
								}
								newNotice.append($(str));
							}

						}
					},
					complete:function(){
					}
				});
	
	
		   //统计单量
		    $.ajax({
					url:'sys/Other/indexManage',
					data:{v2hldghlcib0agugzgf0ysbhy2nlc3m:1},
					type:'post',
					dataType:'json',
					async:false,
					success:function(result){
						if(typeof(result)!='undefined' && result.state == 200){
							var aaData =  result['data']; 
							if(typeof(aaData)!='undefined'){
								var order = aaData['loanStatusCount'],contract = aaData['contractStatusCount'],loanApproverCount=aaData['loanApproverCount'],loanAuditorCount=aaData['loanAuditorCount'];
							    $.each(order,function(key,value){
							    	$('#order'+key).text(value);
							    });
							    
							    $.each(contract,function(key,value){
							    	$('#contract'+key).text(value);
							    });
							    
							    $('#loanApproverCount').text(loanApproverCount);
							    $('#loanAuditorCount').text(loanAuditorCount);
							    
							}

						}
					},
					complete:function(){
					}
				});
	
	//请求后台得到 当前时间 以及一个月以前的时间 按照天数排列成X轴 数组
	
	          $.ajax({
					url:'sys/Other/indexHighchart',
					data:{v2hldghlcib0agugzgf0ysbhy2nlc3m:1},
					type:'post',
					dataType:'json',
					async:false,
					success:function(result){
						if(typeof(result)!='undefined' && result.state ==200){
							var aaData =  result.data; 
							var x = aaData['x'],y1 = aaData['y1'],y2 = aaData['y2'];
							 var myChart = echarts.init(document.getElementById('container'));
								var option = {
								title : {
									text: '放款数据统计',
									subtext: '金腰贷'
								},
								tooltip : {
									trigger: 'axis'
								},
								legend: {
									data:['总放款','已收款']
								},
								toolbox: {
									show : true,
									feature : {
										mark : {show: true},
										dataView : {show: true, readOnly: false},
										magicType : {show: true, type: ['line', 'bar']},
										restore : {show: true},
										saveAsImage : {show: true}
									}
								},
								calculable : true,
								xAxis : [
									{
										type : 'category',
										boundaryGap : false,
										data : x
									}
								],
								yAxis : [
									{
										type : 'value',
										axisLabel : {
											formatter: '{value} ￥'
										}
									}
								],
								series : [
									{
										name:'总放款',
										type:'line',
										data:y1,
										markPoint : {
											data : [
												{type : 'max', name: '最大值'},
												{type : 'min', name: '最小值'}
											]
										},
										markLine : {
											data : [
												{type : 'average', name: '平均值'}
											]
										}
									},
									{
										name:'已收款',
										type:'line',
										data:y2,
										markPoint : {
											data : [
												/*{name : '周最低', value : 5, xAxis: 1, yAxis: -1.5}*/
						                        {type : 'max', name: '最大值'},
												{type : 'min', name: '最小值'}
											]
										},
										markLine : {
											data : [
												{type : 'average', name : '平均值'}
											]
										}
									}
								]
							};
						   myChart.setOption(option);

						}
					},
					complete:function(){
					}
				});
	
	   
	
	/*$.ajax({
					url:'sys/Other/indexHighchart',
					data:{},
					type:'post',
					dataType:'json',
					async:false,
					success:function(result){
						if(typeof(result)!='undefined' && result.state ==200){
							var aaData =  result.data; 
							var x = aaData['x'],y1 = aaData['y1'],y2 = aaData['y2'];
							 $('#container').highcharts({
							    	colors: ["#7cb5ec", "#f7a35c", "#90ee7e", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee", "#55BF3B", "#DF5353", "#7798BF", "#aaeeee"],
							        title: {
							            text: '数据统计',
							            x: -20 //center
							        },
							        subtitle: {
							            text: 'www.jinyaod.com',
							            x: -20
							        },
							        xAxis: {
							            categories: x
							        },
							        yAxis: {
							            title: {
							                text: '贷款金额（万元）'
							            },
							            plotLines: [{
							                value: 0,
							                width: 1,
							                color: '#808080'
							            }]
							        },
							        tooltip: {
							            valueSuffix: '￥'
							        },
							        legend: {
							            layout: 'vertical',
							            align: 'right',
							            verticalAlign: 'middle',
							            borderWidth: 0
							        },
							        series: [{
							            name: '总放款',
							            data: y1
							        }, {
							            name: '已收款',
							            data: y2
							        }]
							    });

						}
					},
					complete:function(){
					}
				});*/
});
</script>

</head>


<body>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">首页</a></li>
    <li><a href="#">我的桌面</a></li>
    </ul>
    </div>
    
    
    <div class="mainbox">
    
    <div class="maintop">
    <div class="leftinfo">
    	<div class="listtitle"><a href="javascript:void(0)" class="more1">年</a><a href="javascript:void(0)" class="more1">月</a><a href="javascript:void(0)" class="more1">周</a>数据统计</div>

    	<div id="container" style="min-width:700px;height:245px"></div>
    </div>
    </div>
    <!--mainleft end-->
    
    
    <div class=mainbuttom>
    
    
    <div class="buttomleft">
    <div class="listtitle"><a href="javascript:void(0)" class="more1">更多</a>最新信息</div>    
    <ul class="newlist"  id="newNotice">
    </ul>        
    </div>
    
    
    <div class="buttomright">
    <div class="listtitle"><a href="javascript:void(0)" class="more1">更多</a>推送信息 </div>    
    <ul class="newlist">
    <li><a href="javascript:void(0)">2015-09-05 12:09:01 向小白推送了一个方案</a></li>
	<li><a href="javascript:void(0)">2015-09-05 12:10:06 向小白推送了一个方案</a></li>
	<li><a href="javascript:void(0)">2015-09-05 12:11:09 向小白推送了一个方案</a></li>
	<li><a href="javascript:void(0)">2015-09-05 12:12:01 向小白推送了一个方案</a></li>    
    </ul>   
    </div>
    
    
    
    
    </div>
    
    
    
    
    <!--mainright end-->
    </div>



</body>

</html>